package com.heima.reggie.controller;

import com.heima.reggie.common.R;
import com.heima.reggie.service.SmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/sms")
@Api(tags = "验证码管理")
public class SmsController {
    @Autowired
    private SmsService smsService;

    @ApiOperation(value ="发送验证码")
    @GetMapping("/code")
    public R SendCode(String phone, HttpSession session) {
        String code = smsService.senCode(phone);
        return R.success(code);
    }
}
